package com.ldy.core.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ldy.core.common.Result;
import com.ldy.core.service.BaseMenuService;
import com.ldy.core.util.MenuConfigUtil;

/**
 * 菜单管理
 */
@RestController
@RequestMapping("/menu")
@CrossOrigin(allowCredentials = "true", allowedHeaders = "*")
public class MenuController {

	@Autowired
	private BaseMenuService menuService;
	/**
	 * 列表查询
	 * @return
	 */
	@PostMapping("/selectList")
	public Result selectList() {
		return Result.success(menuService.list());
	}
	
	/**
	 * 获取当前应用菜单
	 * @return
	 */
	@PostMapping("/getAppMenu")
	public Result getAppMenu() {
		return Result.success(MenuConfigUtil.get());
	}
}
